package cn.dsp.admin.utils;

import cn.dsp.admin.entity.admin.Admin;
import cn.dsp.admin.entity.lot.Lot;

import java.io.Serializable;
import java.util.Iterator;
import java.util.List;

public class IteratorUtils implements Serializable {

    private static final long serialVersionUID = 457680437391375333L;

    /**迭代过滤器*/
    public List<Admin> adminsIterator(List<Admin> admins, Integer storeId){
        //遍历查询结果，移除非当前uid的数据
        Iterator<Admin> iterator = admins.iterator();
        while(iterator.hasNext()){
            Admin item = iterator.next();
            if (!item.getStoreId().equals(storeId)){
                iterator.remove();
            }
        }
        //返回
        return admins;
    }
    /**迭代过滤器*/
    public List<Lot> LotIterator(List<Lot> lots, Integer storeId){
        //遍历查询结果，移除非当前uid的数据
        Iterator<Lot> iterator = lots.iterator();
        while(iterator.hasNext()){
            Lot item = iterator.next();
            if (!item.getStoreId().equals(storeId)){
                iterator.remove();
            }
        }
        //返回
        return lots;
    }

}
